home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl5
-
- # nfs-mount.cgi
-
- # notes: \ at end of line to continue not supported.
- # (this is supported for nfs-export)
-
- require "/usr/OnRamp/lib/OnRamp.pm";
- require "/usr/OnRamp/lib/java.pm";
-
- $myname = "nfs-mount.cgi";
- $title = "Filesystem Configuration";
- $conf = "/etc/fstab";
- $temp = "/etc/fstab.tmp";
-
- $account_type_uc = "Filesystem";
- $account_type_lc = "filesystem";
-
- $js_main =
- "type = \"filesystem\";
- $js_account_main
- $js_error_box
- $js_filename
- $js_hostname
- function testFilesystem(form, Ctrl, what) {
- colon = Ctrl.value.indexOf(':', 0);
- if (colon < 0) {
- if (!testFilename(Ctrl, what)) return (false);
- } else {
- host = Ctrl.value.substring(0, colon);
- file = Ctrl.value.substring(colon + 1);
- if (!testHostname(Ctrl, host, what, 0)) return (false);
- if (!testThisFilename(form.edit, file, what)) return (false);
- }
- return (true);
- }
- function testThisFilename(Ctrl, word, what) {
- if (word == \"\") {
- errorBox (Ctrl, \"The \" + what + \" is required.\");
- return (false);
- }
- if (!testFileChars(word)) {
- errorBox (Ctrl, \"The \" + what + \" cannot \\ncontain \"
- + illegal + \" characters.\");
- return (false);
- }
- for(i = 0; i < word.length; i++) {
- if (word.charAt(i) == ' ') {
- errorBox (Ctrl, \"The \" + what + \" cannot \\ncontain spaces.\");
- return (false);
- }
- }
- if (word.charAt(0) != '/') {
- errorBox (Ctrl, \"The \" + what + \" must be fully qualified.\");
- return (false);
- }
- return (true);
- }
- function testFileChars(word) {
- metaChars = \"{}()*!~<>?|[]'&^\$\@\#`\\\";:\";
- for(j = 0; j < metaChars.length; j++) {
- illegal = metaChars.charAt(j);
- if (word.indexOf (illegal, 0) != -1) return (false);
- } return (true);
- }
- function testAdd(form) {
- if (form.new_account.value == \"\") {
- errorBox (form.new_account, \"To add an existing \" + type + \", \"
- + \"first enter a \" + type + \"\\n\"
- + \"then click the add button.\");
- return (false);
- }
- if (!testFilesystem(form, form.new_account, \"filesystem\")) return (false);
- return (true);
- }";
-
- $js_edit =
- "$js_standard
- $js_error_box
- $js_filename
- function checkForm(form) {
- if (!testFilename(form.dir, \"mount directory\")) return (false);
- return (true);
- }";
-
- $js_options =
- "$js_check_int
- $js_standard
- $js_error_box
- $js_filename
- function testNumber(Ctrl, what) {
- if (Ctrl.value == \"\") return (true);
- if (! checkInt(Ctrl.value, 10)) {
- errorBox(Ctrl, \"The \" + what + \" entered is not a number.\");
- return (false);
- }
- return (true);
- }
- function testVersion(Ctrl, what) {
- if (Ctrl.value == \"\") return (true);
- if (Ctrl.value != \"2\" && Ctrl.value != \"3\") {
- errorBox(Ctrl, \"The \" + what + \" must be 2 or 3.\");
- return (false);
- }
- return (true);
- }
- function testPortNo(Ctrl, what) {
- if (Ctrl.value == \"\") return (true);
- num = parseInt(Ctrl.value);
- if ((! checkInt(Ctrl.value, 10)) || num < 0 || num > 65536) {
- errorBox(Ctrl, \"The \" + what + \" must be a number between 0 and 65,535\");
- return (false);
- }
- return (true);
- }
- function testPriority(Ctrl, what) {
- if (Ctrl.value == \"\") return (true);
- num = parseInt(Ctrl.value);
- if ((! checkInt(Ctrl.value, 10)) || num < 0 || num > 7) {
- errorBox(Ctrl, \"The \" + what + \" must be a number between 0 and 7\");
- return (false);
- }
- return (true);
- }
- function testFile(Ctrl, what) {
- if (Ctrl.value == \"\") return (true);
- if (!testFilename(Ctrl, what)) return (false);
- return (true);
- }
- function checkForm(form) {
- type = form.type.value;
- if (type != \"swap\" && type != \"cachefs\") {
- if (!testFile(form.raw, \"raw device pathname\")) return (false);
- if (!testNumber(form.lbsize, \"transfer bytes\")) return (false);
- }
- if (type == \"iso9660\") {
- if (!testNumber(form.cache, \"caching blocks\")) return (false);
- }
- if (type == \"iso9660\" || type == \"hfs\") {
- if (!testNumber(form.partition, \"DOS partition\")) return (false);
- }
- if (type == \"nfs\") {
- if (!testVersion(form.vers, \"NFS version\")) return (false);
- if (!testNumber(form.retry, \"mount retry times\")) return (false);
- if (!testNumber(form.rsize, \"read buffer size\")) return (false);
- if (!testNumber(form.wsize, \"write buffer size\")) return (false);
- if (!testNumber(form.timeo, \"NFS timeout\")) return (false);
- if (!testNumber(form.retrans, \"NFS retransmissions\")) return (false);
- if (!testPortNo(form.port, \"UDP port number\")) return (false);
- if (!testNumber(form.symttl, \"time-to-live\")) return (false);
- }
- if (type == \"nfs\" || type == \"cachefs\") {
- if (!testNumber(form.acregmin, \"cache timeout\")) return (false);
- if (!testNumber(form.acregmax, \"cache timeout\")) return (false);
- if (!testNumber(form.acdirmin, \"cache timeout\")) return (false);
- if (!testNumber(form.acdirmax, \"cache timeout\")) return (false);
- if (!testNumber(form.actimeo, \"cache timeout\")) return (false);
- }
- if (type == \"swap\") {
- if (!testPriority(form.pri, \"priority\")) return (false);
- if (!testNumber(form.swplo, \"starting block\")) return (false);
- if (!testNumber(form.slength, \"swap size\")) return (false);
- if (!testNumber(form.maxlength, \"maximum swap size\")) return (false);
- if (!testNumber(form.vlength, \"virtual length\")) return (false);
- }
- if (type == \"cachefs\") {
- if (!testFile(form.backpath, \"mount point\")) return (false);
- if (!testFile(form.cachedir, \"cache directory\")) return (false);
- }
-
- return (true);
- }";
-
-
- print "Content-type: text/html\n\n";
-
- &get_fields;
-
- &getAccounts;
-
- if (%fld) {
- $fld{'chosen'} =~ /([\w.-\/:]+)/;
- $name = $1;
-
- $help = $document_root . $ENV{"SCRIPT_NAME"};
- $help =~ s/cgi$/hlp/;
- exec $help if ($fld{'help'} eq "Help");
-
- if ($fld{'options'} eq "Options") {
- &make_options;
- }
- if ($fld{'add'}) {
- $name = $fld{'new_account'};
- $ttl = "Add Filesystem";
- &editAccount;
- }
- if ($fld{'edit'} || $fld{'get_options'}) {
- if ($fld{'edit'}) { &get_vals($name); }
- else {
- $val{'dir'} = $fld{'dir'};
- $val{'type'} = $fld{'type'};
- $name = $fld{'chosen'};
-
- $val{'opt_string'} = &create_opt_string;
-
- $message .= "Click \"Ok\" to save changes.";
- }
- $ttl = "Edit Filesystem";
- &editAccount;
- exit 0;
- }
- if ($fld{'ok'}) {
- &doEdit;
- &getAccounts;
- &generic;
- }
- if ($fld{'delete'}) {
- $message = qq|Click "Ok" to save changes.|;
- $delete = 1;
- &generic;
- }
- if ($fld{'doit'}) {
- if ($fld{'delFile'}) {
- &delete($fld{'delFile'});
- &getAccounts;
- }
- &generic;
- }
- } else { &generic; }
-
- sub delete {
- open(IN, "< $conf");
- open(OUT, "> $temp");
- while(<IN>) {
- @items = split(/\s+/);
- if ($items[0] ne $_[0]) { print OUT $_; }
- }
- close(IN);
- close(OUT);
-
- rename($temp, $conf);
-
- $message .= "Entry deleted.";
- }
-
- sub doEdit {
- $new_line = "$fld{'chosen'} $fld{'dir'} $fld{'type'} $fld{'opt_string'} 0 0";
-
- if ($fld{'mode'} eq "add") {
- open(OUT, ">> $conf");
- print OUT "$new_line\n";
- close(OUT);
-
- $message .= "Entry added.";
- } else {
- open(IN, "< $conf");
- open(OUT, "> $temp");
- while(<IN>) {
- @items = split(/\s+/);
- if ($items[0] eq $fld{'chosen'}) {
- print OUT "$new_line\n";
- } else { print OUT $_; }
- }
- close(IN);
- close(OUT);
-
- rename($temp, $conf);
-
- $message .= "Entry edited.";
- }
- }
-
- sub get_vals {
- for($i=0; $i<=$#accounts; $i++) {
- if ($accounts[$i] eq $_[0]) {
- $val{'dir'} = $dir[$i];
- $val{'type'} = $type[$i];
- $val{'opt_string'} = $opt_string[$i];
- }
- }
- }
-
- sub create_opt_string {
- &get_options;
- &get_defs;
-
- undef (@opts);
-
- if ($fld{'ro'} eq "No") { push(@opts, "rw"); }
-
- if ($fld{'type'} ne 'swap' && $fld{'type'} ne 'cachefs') { &add_opts(*st_opt); }
-
- if ($fld{'type'} eq 'iso9660') { &add_opts(*iso_opt); }
- elsif ($fld{'type'} eq 'hfs') { &add_opts(*hfs_opt); }
- elsif ($fld{'type'} eq 'nfs') { &add_opts(*nfs_opt); }
- elsif ($fld{'type'} eq 'cachefs') { &add_opts(*cache_opt); }
- elsif ($fld{'type'} eq 'swap') { &add_opts(*swap_opt); }
-
- return join(',', @opts);
- }
-
- sub add_opts {
- local(*lst) = $_[0];
-
- for ($i=0; $i<$#lst; $i+=3) {
- next if $fld{$lst[$i]} eq $def{$lst[$i]};
- if ($lst[$i+1] eq 'r') { push(@opts, $lst[$i]); }
- elsif ($lst[$i] eq "slength") { push(@opts, "length=$fld{$lst[$i]}"); }
- elsif ($lst[$i+1] eq 't') {
- push(@opts, "$lst[$i]=$fld{$lst[$i]}") if $fld{$lst[$i]};
- } else {
- if ($lst[$i] eq 'nmconv') {
- undef ($ch);
- $ch = "c" if $fld{'nmconv'} eq "Don't translate to UNIX";
- $ch = "l" if $fld{'nmconv'} eq "Translate to lower case";
- $ch = "m" if $fld{'nmconv'} eq "Suppress version number";
-
- if ($ch) { push(@opts, "nmconv=$ch"); }
- } elsif ($lst[$i] eq 'backfstype') {
- push(@opts, "$lst[$i]=$fld{$lst[$i]}");
- } elsif ($lst[$i] eq 'write-around') {
- push(@opts, "write-around");
- }
- }
- }
- }
-
- sub get_defs {
- for ($i=0; $i<$#st_opt; $i+=3) {
- if ($st_opt[$i+1] eq 'r') { $def{$st_opt[$i]} = "No"; }
- }
- for ($i=0; $i<$#iso_opt; $i+=3) {
- if ($iso_opt[$i+1] eq 'r') { $def{$iso_opt[$i]} = "No"; }
- }
- for ($i=0; $i<$#nfs_opt; $i+=3) {
- if ($nfs_opt[$i+1] eq 'r') { $def{$nfs_opt[$i]} = "No"; }
- }
-
- $def{'partition'} = 1;
- $def{'cache'} = 128;
- $def{'retry'} = 10000;
- $def{'rsize'} = 8096;
- $def{'wsize'} = 8096;
- $def{'timeo'} = 11;
- $def{'retrans'} = 5;
- $def{'port'} = 2049;
- $def{'hard'} = "Yes";
- $def{'acregmin'} = 3;
- $def{'acregmax'} = 60;
- $def{'acdirmin'} = 30;
- $def{'acdirmax'} = 60;
- $def{'symttl'} = 3600;
-
- $def{'swplo'} = 0;
-
- if ($fld{'type'} eq "cachefs") {
- $def{'actimeo'} = 30;
- }
-
- $def{'nmconv'} = "None";
- $def{'backfstype'} = "default";
- $def{'write-around'} = "non-shared";
-
-
- }
-
- sub get_options {
- @st_opt = ( 'ro', 'r', 'Mount read-only?',
- 'noauto', 'r', 'Ignore during "mount -a" command?',
- 'grpid', 'r', 'Set group id to group id of parent directory?',
- 'nosuid', 'r', 'Setuid execution not allowed for non-superusers?',
- 'nodev', 'r', 'Deny access to character and block special files?',
- 'dmi', 'r', 'Enable the Data Management Interface event callouts?',
- 'raw', 't', 'Raw device pathname:',
- 'fsck', 'r', 'Check this filesystem when "fsck" invoked with no arguments?',
- 'nofsck', 'r', 'Have "fsck" not check this filesystem by default?',
- 'quota', 'r', 'Enforce disk quotas?',
- 'noquota', 'r', 'Do not enforce disk quotas?',
- 'lbsize', 't', 'Number of bytes to transfer in each read or synchronous '
- . 'write operation:'
- );
-
- @iso_opt = ( 'setx', 'r', 'Set execute permission on all files?',
- 'notranslate', 'r', 'Don\'t translate ISO 9660 filenames to UNIX filenames?',
- 'cache', 't', 'Number of 2048 byte blocks used for caching:',
- 'noext', 'r', 'Ignore Rock Ridge extensions?',
- 'susp', 'r', 'Enable processing of System Use Sharing Protocol?',
- 'nosusp', 'r', 'Disable processing of System Use Sharing Protocol?',
- 'rrip', 'r', 'Enable processing of the Rock Ridge extensions?',
- 'norrip', 'r', 'Disable processing of the Rock Ridge extensions?',
- 'nmconv', 's', 'Filename translation control:',
- 'partition', 't', 'Number of DOS partition to mount:'
- );
-
-
- @hfs_opt = ( 'partition', 't', 'Number of DOS partition to mount:' );
-
- @nfs_opt = ( 'vers', 't', 'NFS protocol version:',
- 'bg', 'r', 'If the first mount attempt fails, retry in the background?',
- 'retry', 't', 'Number of times to retry mount in case of failure:',
- 'rsize', 't', 'Read buffer size:',
- 'wsize', 't', 'Write buffer size:',
- 'timeo', 't', 'NFS timeout in tenths of seconds:',
- 'retrans', 't', 'NFS retransmissions:',
- 'port', 't', 'Server UDP port number:',
- 'hard', 'r', 'Retry request until server responds?',
- 'soft', 'r', 'Return error if server doesn\'t respond?',
- 'intr', 'r', 'Allow signal interrupts of accesses?',
- 'acregmin', 't', 'Cache timeout of regular file minimum attribute in seconds:',
- 'acregmax', 't', 'Cache timeout of regular file maximum attribute in seconds:',
- 'acdirmin', 't', 'Cache timeout of directory minimum attribute in seconds:',
- 'acdirmax', 't', 'Cache timeout of directory maximum attribute in seconds:',
- 'actimeo', 't', 'Cache timeout of regular and directory minimum and maximum '
- . 'attribute in seconds:',
- 'noac', 'r', 'No attribute caching?',
- 'private', 'r', 'Do not flush delayed writes on last close of an open file, '
- . 'and use local file and record locking instead of '
- . 'a remote lock manager?',
- 'shortuid', 'r', 'Do not let users with userids or groupids larger than 65535 '
- . 'create or own files?',
- 'symttl', 't', 'Time-to-live of symbolic links cached by NFS',
- 'asyncnlm', 'r', 'Use asynchronous NLM RPC calls?'
- );
-
- @swap_opt = ( 'noauto', 'r', 'Ignore during "mount -a" command?',
- 'pri', 't', 'Priority level of swap device:',
- 'swplo', 't', 'Starting 512 byte block:',
- 'slength', 't', 'Number of 512 byte blocks to use:',
- 'maxlength', 't', 'Maximum number of 512 byte blocks to grow swap area to:',
- 'vlength', 't', 'Number of virtual 512 byte blocks to claim this swap area has:'
- );
-
- @cache_opt = ( 'backfstype', 's', 'Filesystem type of back filesystem:',
- 'backpath', 't', 'Point where back filesystem is already mounted:',
- 'cachedir', 't', 'Name of cache directory:',
- 'cacheid', 't', 'Cache ID string:',
- 'write-around', 's', 'Write mode for cache filesystem:',
- 'noconst', 'r', 'Disable consistency checking?',
- 'private', 'r', 'Perform file and record locking locally?',
- 'local-access', 'r', 'Allow front filesystem to interpret the mode bits used for '
- . 'access checking?',
- 'purge', 'r', 'Purge cached information for filesystem?',
- 'nosuid', 'r', 'Disallow set-uid execution?',
- 'acregmin', 't', 'Minimum hold time for cached attributes:',
- 'acregmax', 't', 'Maximum hold time for cached attributes:',
- 'acdirmin', 't', 'Minimum hold time for cached attributes after directory update:',
- 'acdirmax', 't', 'Maximum hold time for cached attributes after directory update:',
- 'actimeo', 't', 'Common value for above four caching times:',
- 'bg', 'r', 'Run mount in background if back filesystem mount times out?',
- 'disconnect', 'r', 'Operate cache filesystem in disconnected mode when the '
- . 'back filesystem fails to respond?'
- );
- }
-
- sub read_opts {
- open(IN, "< $conf");
- while(<IN>) {
- @items = split(/\s+/);
- if ($items[0] eq $_[0]) {
- @opts = split(/,/, $items[3]);
- foreach (@opts) {
- if ($_ =~ /^(.*)=(.*)$/) {
- if ($1 eq "nmconv") {
- $val{'nmconv'} = "Don't translate to UNIX" if $2 eq "c";
- $val{'nmconv'} = "Translate to lower case" if $2 eq "l";
- $val{'nmconv'} = "Suppress version number" if $2 eq "m";
- } else { $val{$1} = $2; }
- } else { $val{$_} = "Yes"; }
- }
- }
- }
- close(IN);
- }
-
- sub make_options {
- &get_options;
- &get_defs;
- %val = %def;
- &read_opts($fld{'chosen'});
-
- &js_title_block($title,$js_options);
- &header_block("Options for $fld{'type'}");
-
- print "<form name=StandardForm action=$myname method=post onSubmit=\"return runSubmit()\">";
-
- print "<input type=hidden name=\"get_options\" value=\"get_options\">\n";
- print "<input type=hidden name=\"chosen\" value=$fld{'chosen'}>\n";
- print "<input type=hidden name=\"dir\" value=$fld{'dir'}>\n";
- print "<input type=hidden name=\"type\" value=$fld{'type'}>\n";
- print qq|<input type=hidden name="mode" value=$fld{'mode'}>|;
-
- if ($fld{'type'} ne 'swap' && $fld{'type'} ne 'cachefs') {
-
- print "<h2>Standard Options:</h2>\n";
- print "<center><table cellpadding=5 width=450>";
-
- for($i=0; $i<$#st_opt; $i+=3) {
- print "<tr><th align=left>$st_opt[$i+2]</th><th align=left>";
- if ($st_opt[$i+1] eq 'r') { print &radio($st_opt[$i], $val{$st_opt[$i]}, "Yes", "No"); }
- elsif ($st_opt[$i+1] eq 't') { print &text($st_opt[$i], $val{$st_opt[$i]}, 20); }
- else { ; }
- print "</th></tr>\n";
- }
-
- print "</table></center><br>";
- }
-
- if ($fld{'type'} eq 'iso9660') {
-
- print "<h2>ISO9660 Options:</h2>\n";
- print "<center><table cellpadding=5 width=450>";
-
- for($i=0; $i<$#iso_opt; $i+=3) {
- print "<tr><th align=left>$iso_opt[$i+2]</th><th align=left>";
- if ($iso_opt[$i+1] eq 'r') { print &radio($iso_opt[$i], $val{$iso_opt[$i]}, "Yes", "No"); }
- elsif ($iso_opt[$i+1] eq 't') { print &text($iso_opt[$i], $val{$iso_opt[$i]}, 20); }
- else { print &select($iso_opt[$i], $val{$iso_opt[$i]}, "None", "Don't translate to UNIX",
- "Translate to lower case", "Suppress version number"); }
- print "</th></tr>\n";
- }
-
- print "</table></center><br>";
-
- } elsif ($fld{'type'} eq 'hfs') {
-
- print "<h2>HFS Options:</h2>\n";
- print "<center><table cellpadding=5 width=450>";
-
- print "<tr><th align=left>Number of DOS partition to mount:</th><th align=left>";
- print &text("partition", $val{'partition'}, 20);
- print "</th></tr>\n";
-
- print "</table></center><br>";
-
- } elsif ($fld{'type'} eq 'nfs') {
-
- print "<h2>NFS Options:</h2>\n";
- print "<center><table cellpadding=5 width=450>";
-
- for($i=0; $i<$#nfs_opt; $i+=3) {
- print "<tr><th align=left>$nfs_opt[$i+2]</th><th align=left>";
- if ($nfs_opt[$i+1] eq 'r') { print &radio($nfs_opt[$i], $val{$nfs_opt[$i]}, "Yes", "No"); }
- elsif ($nfs_opt[$i+1] eq 't') { print &text($nfs_opt[$i], $val{$nfs_opt[$i]}, 20); }
- else { ; }
- print "</th></tr>\n";
- }
-
- print "</table></center><br>";
-
- } elsif ($fld{'type'} eq 'swap') {
-
- print "<h2>Swap Options:</h2>\n";
- print "<center><table cellpadding=5 width=450>";
-
- for($i=0; $i<$#swap_opt; $i+=3) {
- print "<tr><th align=left>$swap_opt[$i+2]</th><th align=left>";
- if ($swap_opt[$i+1] eq 'r') { print &radio($swap_opt[$i], $val{$swap_opt[$i]}, "Yes", "No"); }
- elsif ($swap_opt[$i+1] eq 't') { print &text($swap_opt[$i], $val{$swap_opt[$i]}, 20); }
- else { ; }
- print "</th></tr>\n";
- }
-
- print "</table></center><br>";
-
- } elsif ($fld{'type'} eq 'cachefs') {
-
- print "<h2>Cachefs Options:</h2>\n";
- print "<center><table cellpadding=5 width=450>";
-
- for($i=0; $i<$#cache_opt; $i+=3) {
- print "<tr><th align=left>$cache_opt[$i+2]</th><th align=left>";
- if ($cache_opt[$i+1] eq 'r') { print &radio($cache_opt[$i],
- $val{$cache_opt[$i]}, "Yes", "No"); }
- elsif ($cache_opt[$i+1] eq 't') { print &text($cache_opt[$i], $val{$cache_opt[$i]}, 20); }
- elsif ($cache_opt[$i] eq "backfstype") {
- print &select($cache_opt[$i], $val{$cache_opt[$i]}, "default", "nfs", "nfs3",
- "iso9660", "dos", "cdfs", "kfs", "hfs");
- } else {
- print &select($cache_opt[$i], $val{$cache_opt[$i]},
- "write-arount", "non-shared");
- }
- print "</th></tr>\n";
- }
-
- print "</table></center><br>";
- }
-
- print &js_buttons('ok','Ok','onClick="markOK()"','onClick="markOther()"');
-
- print "</form></body></html>";
- }
-
-
- sub editAccount {
- &js_title_block($title,$js_edit);
- &header_block($ttl);
-
- print "<i>$message</i>\n";
-
- print "<form name=StandardForm action=$myname method=post onSubmit=\"return runSubmit()\">";
-
- print qq|<input type=hidden name="chosen" value=$name>|;
- if ($fld{'add'}) { $mode = "add"; } else { $mode = "edit"; }
- $mode = $fld{'mode'} if $fld{'mode'};
- print qq|<input type=hidden name="mode" value=$mode>|;
- print qq|<input type=hidden name="opt_string" value=$val{'opt_string'}>\n|;
-
- print "<center><table cellpadding=5 width=450>";
-
- print "<tr><th align=left>Filesystem:</th><th align=left>$name</th></tr>";
-
- print "<tr><th align=left>Mount directory:</th><th align=left>",
- &text('dir', $val{'dir'}, 20),
- "</th></tr>\n";
-
- print "<tr><th align=left>Filesystem type:</th><th align=left>",
- &select('type', $val{'type'}, 'xfs', 'efs', 'nfs', 'proc', 'fd',
- 'cdfs', 'iso9660', 'cdda', 'dos', 'hfs', 'swap',
- 'cachefs', 'rawdata'),
- "</th></tr>\n";
-
- print "<tr><th align=left>Set Advanced Options:</th><th align=left>",
- "<input type=submit name=\"options\" value=\"Options\">",
- "</th></tr>";
-
- print "</table></center><br>";
-
- print &js_buttons('ok','Ok','onClick="markOK()"','onClick="markOther()"');
-
- print "</form></body></html>";
- }
-
- sub getAccounts {
- undef (@dir);
- undef (@accounts);
- undef (@type);
- undef (@opt_string);
-
- open(IN, "< $conf");
- while (<IN>) {
- next if $_ eq "\n";
- next if $_ =~ /^\s+#/;
- @items = split(/\s+/);
- push(@accounts, $items[0]);
- push(@dir, $items[1]);
- push(@type, $items[2]);
- push(@opt_string, $items[3]);
- }
- close(IN);
- }
-
- sub generic {
- &js_title_block($title,$js_main);
- &header_block($title);
-
- print "<i>$message</i>";
-
- print "<form name=AccountForm action=$myname method=post "
- . "onSubmit=\"return runSubmit()\">";
-
- if ($delete) {
- print "<input type=hidden name=\"delFile\" value=$name>\n";
- }
-
- print "<table width=400><center>\n";
- print "<tr><td><input type=submit name=\"add\" onClick=\"markAdd()\" \n"
- . "value=\"Add New $account_type_uc\"\n"
- . "</td><td><input name=\"new_account\" value=\"$val{'new_account'}\"\n"
- . "size=19 onClick=\"markAdd()\"></td></tr>\n";
-
- if ($#accounts >= 0) {
- if ($_[0]) {
- undef @show_accts;
- foreach $arg (@accounts) {
- push(@show_accts, $arg) if $arg ne $_[0];
- }
- print "<input type=hidden name=deleted value=$_[0]>\n";
- } else { @show_accts = @accounts; }
-
- print "<tr><td>\n"
- . "<input type=submit name=\"edit\" onClick=\"markEdit()\" \n"
- . "value=\"Edit Selected $account_type_uc\"></td><td rowspan=2>";
- print &choice_list(*show_accts, "chosen", 20);
- print "</td/tr>\n"
- . "<tr><td><input type=submit name=\"delete\" onClick=\"markDelete()\" \n"
- . "value=\"Delete Selected $account_type_uc\"></td></tr>\n";
- }
-
- print "</table></center><br>";
-
- print &buttons('doit','Ok','onClick="markOK()"','onClick="markOther()"');
-
- print "</form></body></html>";
- }
-
-